home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / memory / realflat / realflat.txt < prev   
Internet Message Format  |  1994-10-30  |  4KB

  1. From frendzel@gary.com Sun Oct 30 20:11:28 1994
  2. Date: Fri, 28 Oct 94 14:20:46 EST
  3. From: frendzel@gary.com
  4. Newsgroups: rec.games.programmer
  5. Organization: Gary's Place BBS
  6. Subject: REAL FLAT MODE
  7.  
  8.  
  9.  Someone here wanted to know about 32 bit real mode, well here is a post
  10. that might help you out, from FidoNet 80x86 (Assembler Programming)
  11. One you you bi-lingual-ites could help translating the spanish comments
  12. to english.
  13.  
  14.  
  15. Carl Frendzel   frendzel@gary.com    preferred
  16.                cfrendzel@delphi.com  not used much unless ftp'n to
  17.                                      x2ftp!<G>.
  18. ------------------------------------------------------------------------
  19.  Msg:    #49
  20.  Date:    10-21-94 01:51 (Public)
  21.  From:    Jon Beltran de Heredia
  22.  To:      All
  23.  Subject: Real flat mode
  24.  
  25.   Hello, All!
  26.  
  27.   As I've seen lots of misunderstanding on the deal of real flat mode, I'm
  28. posting a little piece of it. I did it several months ago...
  29.  
  30.   The worst things I have heard are that:
  31.  
  32. '...real mode segments that begin in 64K boundaries (base=seg SHL 16)...'
  33. '...and then you switch to real mode by resetting the CPU...'
  34. (that was a 286'er, hey?)
  35.  
  36. IDEAL
  37. MODEL SMALL
  38. P386
  39. STACK
  40. DATASEG
  41.  
  42. ; Tabla de descriptores
  43. LABEL DescTabl
  44.  
  45.         DB 8 DUP (?)            ; Descriptor 0 no utilizado
  46.  
  47.         DW 0FFFFh               ; 4 Gigabyte (64K pag) de tama$o
  48.         DW 0                    ; b15..0  del origen
  49.         DB 0                    ; b23..16 del origen
  50.         DB 10010010b            ; b7:  presente (s! = 1)
  51.                                 ; b65: privilege level (00)
  52.                                 ; b4:  segmento de sistema:  (no=1)
  53.                                 ; b3:  no ejecutable (0)
  54.                                 ; b2:  no hacia abajo (0)
  55.                                 ; b1:  escribible (1)
  56.                                 ; b0:  acceso (no a#n)
  57.         DB 11001111b            ; b7:  granularidad (p ginas = 1)
  58.                                 ; b6:  grande (?) (s! = 1)
  59.                                 ; b5:  (?)    (0)
  60.                                 ; b4:  no utilizado (0)
  61.                                 ; b30: 19..16 del l!mite (1111)
  62.         DB 0                    ; b31..24 del origen del segmento
  63.  
  64. texto   DB 'E s t o   e s   e l   t e x t o !   '
  65.  
  66.  
  67. SCREEN_ADDR EQU 0B8000h
  68.  
  69.  
  70. CODESEG
  71. gdtref  DW      0Fh             ; l!mite de la gdt: 2 descriptores
  72. l_ref   DW      OFFSET DescTabl, 0
  73.  
  74. start:  mov     ax,@DATA
  75.         mov     ds,ax
  76.         ; Have to fix up the gdt reference
  77.  
  78.  
  79.  
  80.  
  81.         mov     eax,@DATA
  82.         shl     eax,4
  83.         add     [DWORD PTR l_ref],eax
  84.  
  85.         lgdt    [FWORD PTR cs:gdtref]
  86.         mov     eax,cr0
  87.         or      al,1
  88.         mov     cr0,eax
  89.         jmp     @@n
  90. @@n:
  91.         ; YA ESTAMOS EN PMODE!!!!!!!!!!!
  92. [B      mov     ax,8
  93.         mov     fs,ax           ; Selector del segmento plano de 4 gigas
  94.  
  95.         mov     eax,cr0
  96.         and     al,0FEh
  97.         mov     cr0,eax
  98.         ; ya estamos en rmode :_(((((((((
  99.         ; PERO CON UN SEGMENTO DE 4 GIGAS!!!!
  100.         mov     ecx,9           ; longitud del texto en dwords
  101.         mov     si,OFFSET texto
  102.         mov     edi,SCREEN_ADDR
  103. @@l:    mov     eax,[si]
  104.         mov     [fs:edi],eax
  105.         add     si,4
  106.         add     edi,4
  107.         loopd   @@l
  108.  
  109.         ; Espera que se pulse una tecla
  110.         mov     ah,0
  111.         int     16h
  112.  
  113.         xor     ax,ax
  114.         mov     fs,ax
  115.  
  116.         mov     ax,4C00h
  117.         int     21h
  118.  
  119.         END start
  120.  
  121.   For TASM. Comments in spanish, sorry... the code should be readily
  122. understandable. And by the way, this only works with the processor in real mode
  123.  
  124. (with no memory manager or just poor old HIMEM). You should check that yer not
  125. in v86 just with SMSW AX//TEST AX,1//JNZ @@badluck. Don't use MOV ExX,CR0 'cos
  126. it could cause an exception (it's privileged).
  127.  
  128.   Cheers, :-)
  129.  
  130.   Jon
  131.  
  132. --- FMail 0.92
  133.  * Origin: Yann/Iguana (2:343/121.8)
  134.  
  135.     *** Gary's Place BBS - 412 326-4039 - Internet e-mail and news ***
  136.  
  137.  
  138.